package com.manger.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.manger.common.constant.ExcelDicSortEnum;
import com.manger.model.Dictionary_Data;
import com.manger.model.ProxyIp;

import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

public class DataTools {


	public static Map<String, List<Dictionary_Data>> dictionaryMap = new ConcurrentHashMap<String, List<Dictionary_Data>>();

	public static String baseUrl = "http://47.109.23.189:8086/permission/";
	//public static String baseUrl = "http://127.0.0.1:8080/permission/";

	public static boolean hasUseProxy = true;

	public static String loginUserId = "";

	public static String useProxyId = "";

	public static List<Dictionary_Data> getDicDataByGroupIdAndOrder(String groupId,String order){
		List<Dictionary_Data> list = new ArrayList<>();
		if(!dictionaryMap.containsKey(groupId)){
			return list;
		}
		if(order.equals(ExcelDicSortEnum.DESC.getEnDesc())){
			list = dictionaryMap.get(groupId);
		}else{
			//Collections.reverse(list);
			for(int i = dictionaryMap.get(groupId).size() - 1 ; i >= 0;i--){
				list.add(dictionaryMap.get(groupId).get(i));
			}
		}
		return list;
	}


}
